let url = require("url");

let str = "http://www.baidu.com/hello/index.html?id=12&name=wang#1234789098";

let urlObj = url.parse(str,true);

let {query:{id,name},href} = urlObj;
console.log(id);
console.log(name);
console.log(href);